import VueRouter from 'vue-router';

// 一级路由
import Login from '@/pages/login';
import Main from '@/pages/main';
import Search from '@/pages/search';
import Feedback from '@/pages/feed-back'
import ArticleDetail from '@/pages/article-detail';
import SearchResult from '@/pages/search-result';

// 二级路由
import HomePage from '@/pages/main/pages/homepage';
import QaPage from '@/pages/main/pages/qa';
import VideoPage from '@/pages/main/pages/video';
import MinePage from '@/pages/main/pages/mine';

export default new VueRouter ({
  routes: [
    {
      path: '/',
      component: Main,
      // 重定向
      redirect: '/home',
      children: [
        {
          path: '/home',
          component: HomePage,
        },
        {
          path: '/qa',
          component: QaPage,
        },
        {
          path: '/video',
          component: VideoPage,
        },
        {
          path: '/mine',
          component: MinePage,
        },
      ],
    },
    {
      path: '/login',
      component: Login,
    },
    {
      path: '/search',
      component: Search,
    },
    {
      path: '/search-result',
      component: SearchResult,
    },
    {
      path: '/article-detail/:id',
      name: 'article-detail',
      component: ArticleDetail,
    },
    {
      path: '/feedback',
      component: Feedback,
    },
  // more routes here
  ],
})
